import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Api {
  getApprovalPage = '/admin-api/bpm/approval-process/page',
  getApprovalList = '/admin-api/bpm/approval-process/list',
  addApproval = '/admin-api/bpm/approval-process/create',
  getApproval = '/admin-api/bpm/approval-process/get',
  approvalDelete = '/admin-api/bpm/approval-process/delete',
}

enum OfficeApi {
  getOfficeAdd = '/admin-api/bpm/office/supplies/create',
  getOfficeList = '/admin-api/bpm/office/supplies/page',
  getOfficeInfo = '/admin-api/bpm/office/supplies/get',
}

/**
 * @description: 项目立项
 */
export const getApprovalPage = (params: any) => {
  return defHttp.get<any>({ url: Api.getApprovalPage, params });
};
export const getApprovalList = () => {
  return defHttp.get<any>({ url: Api.getApprovalList });
};
export const addApproval = (params: any) => {
  return defHttp.post<any>({ url: Api.addApproval, params });
};
export const getApproval = (params: any) => {
  return defHttp.get<any>({ url: Api.getApproval, params });
};
export const approvalDelete = (params: any) => {
  return defHttp.delete<any>(
    {
      url: Api.approvalDelete,
      params,
      headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
    },
    { joinParamsToUrl: true },
  );
};

/**
 * @description: 办公室请求申请
 */
export const officeAdd = (params: any) => {
  return defHttp.post<any>({ url: OfficeApi.getOfficeAdd, params });
};
export const officeList = (params: any) => {
  return defHttp.get<any>({ url: OfficeApi.getOfficeList, params });
};
export const officeInfo = (params: any) => {
  return defHttp.get<any>({ url: OfficeApi.getOfficeInfo, params });
};
